package com.mhg.map;

import java.util.HashMap;
import java.util.Hashtable;

public class Demo_04 {
//HashTable  HashMap的区别
	public static void main(String[] args) {
		Hashtable<String, String> ht = new Hashtable<>();
		ht.put("张三", "广州");
		ht.put("李四", "香港");
		//ht.put(null, null);//java.lang.NullPointerException 不允许存储null键null值
		System.out.println(ht);
		
		HashMap<String, String> hm = new HashMap<>();
		hm.put("王五", "天津");
		hm.put("田七", "北京");
		hm.put(null, null);//允许存储null键null值
		hm.put(null, "哈哈哈");
		System.out.println(hm);
		System.out.println(hm.get(null));
	}

}
